﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/UserCenter.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%:SiteResource.Title() %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
<link rel="Stylesheet" type="text/css" href="/Scripts/uploadify/uploadify.css" />
<script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="/Scripts/uploadify/jquery.uploadify.v2.1.4.js"></script>
<script type="text/javascript" src="/Scripts/uploadify/swfobject.js"></script>
    <script type="text/javascript" src="/Scripts/library.js" charset="GB2312"></script>
    <script type="text/javascript" src="/Scripts/plug.js" charset="GB2312"></script>
<script type="text/javascript">
    $(function () {
        $("#uploadify").uploadify({
            'uploader': '/Scripts/uploadify/uploadify.swf',
            'script': '/UserCenter/Upload',
            'cancelImg': '/Scripts/uploadify/cancel.png',
            'queueID': 'fileQueue',
            'auto': true,
            'fileDesc': '请选择jpg、png图片',
            'fileExt': '*.jpg;*.png',
            'onComplete': function (event, queueID, fileObj, response, data) {

                var code = eval('(' + response + ')');
                if (code.result == '1') {
                    $('#currentphoto').attr('src', code.svepath);
                    $('#btnbox').show();
                }
                else {
                    $('#msgbox').text(code.err);
                }
            },
            'multi': false,
            'sizeLimit': 204800
        });
        $('#form1').submit(function () {
            var popframe = new plug.PopFrame();
            popframe.OpenFrame('pop', 'clo', function () {
                $.ajax({
                    url: '/UserCenter/Individuation',
                    type: 'post',
                    cache: false,
                    data: {
                        currentPhoto: $('#currentphoto').attr('src')
                    },
                    success: function (result) {
                        if (result == '1') {
                            $('#loadingmsgbox').text('保存成功');
                            window.setTimeout(function () {
                                $('#clo').trigger('click');
                            }, 1200);
                        }
                        else {
                            $('#loadingmsgbox').text('操作失败，请稍后重试');
                            window.setTimeout(function () {
                                $('#clo').trigger('click');
                            }, 1200);
                        }
                    }
                });
            });
            return false;
        });
    });
    function BeginUpload() {
        $('#uploadify').uploadifyUpload();
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
    <%var user = ViewData["User"] as MemberModel; %>
    <input type="hidden" id="clo" />
    <div class="usercenter-main">
        <div class="usercenter-main-topbg">
        </div>
        <div class="usercenter-main-content">
            <div class="usercenter-main-content-title">
                <div class="usercenter-main-content-title-left">
                    个人资料管理</div>
            </div>
            <div class="usercenter-notes">
                完善您的个人信息，有助于在兼职竞争中拥有更佳的优势，请认真填写您的真实信息！</div>
            <div class="usercenter-tab">
                <div class="usercenter-tab-item">
                    <a href="/UserCenter/Info">基本信息</a></div>
                <div class="usercenter-tab-item">
                    <a href="/UserCenter/Individuation" class="current">头像</a></div>
            </div>
            <form action="UserCenter/Individuation" method="post">
            <div class="usercenter-main-content">
                <div class="usercenter-notes">
                    上传靠谱的头像才更有利于您找到一份好的兼职哦！</div>
                <div class="usercenter-photos">
                    <div class="usercenter-photos-item">
                        <img id="currentphoto" src="<%if(String.IsNullOrEmpty(user.Image)){ %>/Content/Images/no-photo.png<%}else{ %><%:user.Image %><%} %>" style="width:200px;height:220px;" /></div>
                </div>
                <div style="padding-top:10px;">
                    更换头像：<input type="file" name="uploadify" id="uploadify" title="点击选择要上传的照片" />请确保文件为大小不超过200k，格式为jpg、png的图片。</div>
                <div id="fileQueue">
                </div>
                <div id="msgbox" style="color:Red;padding-top:10px;">
                
                </div>
                <div class="textboxs">
                    <div class="textboxs-box" id="btnbox" style="display:none;">
                         <input type="image" src="/Content/Images/usercenter-save.png"/>
                    </div>
                    <div id="msg"></div>
                </div>
            </div>
            </form>
        </div>
        <div class="usercenter-main-bottombg">
        </div>
    </div>
    <div id="pop" style="display:none;width:350px;height:100px;">
    <div id="loadingmsgbox">
    保存中，请稍后......
    </div>
</div>
</asp:Content>
